--[[ 编码: WMS-57-14 名称: 预分配容器-批量预分配容器取消. 作者:HAN 日期:2025-1-29 级别:项目 函数: CancelNoOperation_ORGC 功能: -- 批量取消哪些已经出库作业都不存在的入库组盘(这是巨星测试的时候留下的错误数据) 更改记录: --]] wms_op = require( "wms_operation" ) wms_in = require( "wms_inbound" ) function CancelNoOperation_ORGC( strLuaDEID ) local nRet, strRetInfo -- step1: 找到状态=0、1 local strCondition = "N_B_STATE = 0 OR N_B_STATE = 1" nRet, data_objs = m3.QueryDataObject(strLuaDEID, "Pre_Alloc_Container", strCondition, "S_PAC_NO" ) if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1),"QueryDataObject失败!"..data_objs ) end if ( data_objs == '' ) then return end lua.Debug( strLuaDEID, debug.getinfo(1), "Pre_Alloc_Container", data_objs ) local n, can_cancel local obj_attrs, pac_obj, operation for n = 1, #data_objs do -- 判断作业是否此存在 can_cancel = true nRet, pac_obj = m3.GetDataObject( strLuaDEID, "Pre_Alloc_Container", lua.trim_guid_str(data_objs[n].id) ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), pac_obj ) end nRet, operation = wms_op.GetInfo( strLuaDEID, pac_obj.out_op_no ) if ( nRet == 1 ) then -- 作业不存在 nRet, strRetInfo = wms_in.Pre_Alloc_CNTR_Cancel( strLuaDEID, pac_obj ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), can_cancel ) end -- 增加一个后台进程对组盘进行处理,触发配盘明细中的入库波次是否可以完成 local add_wfp = { wfp_type = 1, cls = "Pre_Alloc_Container", obj_id = pac_obj.id, obj_name = "组盘'"..pac_obj.pac_no.."'-->入库后处理", trigger_event = "入库后处理" } nRet, strRetInfo = m3.AddSysWFP( strLuaDEID, add_wfp ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "AddSysWFP失败!"..strRetInfo ) end end end end